# @Time : 2021/5/24 20:24 

# @Author : zhujianhao

# @File : personalcode.py 

# @Software: PyCharm
from api.base_api import BaseApi


class Personalcode(BaseApi):
    """
    员工活码的api类

    api_path： yml_api的相对路径
    """

    # 简化send_api_data方法路径引用，不用写那么多路径了
    api_path = "TestDatas/PersonalcodeDatas/personalcode.yml"
    host = 'market-test.tangees.com/test'

    # 查询客户活码
    def get_personalcode(self, cookie, current: int = 1, pageSize: int = 10, pageNum: int = 1, order: list = [1], sort: list = ['update_time']) -> dict:
        # Template模板二次修改的值，p_data
        p_data = {"host": self.host, "cookie": cookie, "current": current, "pageSize": pageSize, "pageNum": pageNum, "order": order,
                  "sort": sort}
        # 获取响应，进行了多次封装
        res = self.send_api_data(self.api_path, p_data, "get")
        return res

    def add_personalcode(self, cookie, autoAccept: int, codeName: str, tagIds: list, userList: list) -> dict:
        # Template模板二次修改的值，p_data
        p_data = {"host": self.host, "cookie": cookie, "autoAccept": autoAccept, "codeName": codeName, ":tagIds": tagIds, "userList": userList}
        # 获取响应，进行了多次封装
        res = self.send_api_data(self.api_path, p_data, "add")
        return res


if __name__ == "__main__":
    a = Personalcode()
    cookie = 'accountCenterSessionId=.eJwtkMtKxEAQRf-l17PoV6rSs3UeCCZuhhnMJlR1Vxl1JsIkKij-u0Fd3MWFe-Bwv0yvV5kGs1Y6T7Iyb5Nc-6di1gasQ6EYLTqmbJkjA7pSm5X5G1CG4jlSKJCKsnpwXhMBl1gnVsUqg082OmVbVZ5IUwwBAUrNAUiRyCNkDxJTBoGMFYfaiUQo4AMjVVAVRUZNIZAXdaFoTn4Jao2LSB5oHOW8yHwIL336FWsvu6HbP7j283HuDtvQ3Vjbbpp4d7r1zX47t6fjy_3meGkux3Nz6J4XcBQp_UTv0s-vfeH_O75_ACffVgA.E43kRA.nzDzZXBZCkfxAbhvCJcoa1z3paE'

    print(a.get_personalcode(cookie))
    # print(a.test_token)
    # print(a.add_meeting_room(a.test_token,"a",20,"c","d","e",[1,2]))
    # print(a.edit_meeting_room(a.test_token,1,None,None,None,None,None,None))
    # print(a.delete_meeting_room(a.test_token,1))
    # print(a.add_meeting_room(a.test_token,"ab",11,None,None,None,None))
    # print(a.load_yaml("data/meeting_room/1meeting_room_api.yml")["add"])
